package com.egg.basic.controller.feign;


import com.egg.basic.fegin.BasicEmailFeignClient;
import com.egg.basic.model.request.EmailPost;
import com.egg.basic.util.EmailUtil;
import com.egg.common.core.model.controller.FeignController;
import com.egg.common.core.model.response.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author east
 * @since 2021-12-07
 */
@Api(tags = FeignController.API_PREFIX + "邮件中心")
@RestController
@RequestMapping("/email")
public class FeignEmailController extends FeignController implements BasicEmailFeignClient {


    @Override
    @ApiOperation(value = "发送邮件")
    @PostMapping("/send")
    public ResponseData<String> send(@RequestBody EmailPost param) {
        EmailUtil.send(
                param.getTos()
                , param.getTitle()
                , param.getContent()
                , param.getIsHtml()
        );
        return ResponseData.success();
    }


}

